<%@ taglib prefix="html" uri="http://struts.apache.org/tags-html"%>
<%@ taglib prefix="bean" uri="http://struts.apache.org/tags-bean"%>
<%@ taglib prefix="logic" uri="http://struts.apache.org/tags-logic"%>
<%@ taglib prefix="core" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="display" uri="http://displaytag.sf.net"%>
<%@ page contentType="text/html;charset=UTF-8" language="java"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="id" lang="id">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script>
		window.addEvent('domready', function(){ 
			new Picker.Date('vista1', {
				pickerClass: 'datepicker_vista'
			});
			new Picker.Date('vista2', {
				pickerClass: 'datepicker_vista'
			});
		});
</script>
</head>
<body>
	<html:form action="/leaveSummary.do">
	<div class="outerbox">
		<div class="mainHeading">
			<div class=""
				style="width: 320px; height: 32px; background: url(images/formTitleBackground.png) no-repeat top right; font-color: #CC0000;">
				<h2 class="formTitle">LEAVE SUMMARY</h2>
			</div>
		</div> 
		<div> 
			<br class="clear" />
			&nbsp;&nbsp;
			From date: <html:text property="fromDateStr" styleId="vista1" style="width:170px;"/>
			&nbsp;&nbsp;&nbsp;&nbsp;
			To date: <html:text property="toDateStr" styleId="vista2" style="width:170px;"/>
			&nbsp;&nbsp;&nbsp;&nbsp;
<!-- 			Employee: -->
<%-- 			 <html:text styleId="empTextBoxId" property="empName" style="width:200px;"  --%>
<%-- 							onkeyup="retrieveURL('employeeAjax', 'empTextBoxId');"> </html:text> --%>
			<br class="clear" />
			<br class="clear" />
			<div class="actionbar_form" style="border-top: 2px solid #191919;">
				<div class="actionbuttons">
					<html:submit styleClass="plainbtn" value="Search">Search</html:submit> 
					<html:reset styleClass="plainbtn">Reset</html:reset>
					Total leaved:&nbsp;<bean:write property="totalLeaved" name="leaveSummary"></bean:write>
				</div>
			</div>
			<br class="clear" />
		</div>
	</div>
	<!--   ==================================== TABLE ======================================    -->
	<div class="outerbox">  
			<table
				style="border-collapse: collapse; width: 100%; text-align: left;"
				class="data-table">
				<colgroup align="right">
					<col width="2%" />
					<col width="10%" />
					<col width="7%" />
					<col width="10%" />
					<col width="10%" />
					<col width="7%" />
					<col width="10%" />
					<col width="18%" />
					<col width="7%" /> 
					<col width="9%" />
					<col width="10%" />
					<col width="10%" />
				</colgroup>
				<thead>
					<tr>
						<th></th>
						<th style="text-align: left" rowspan="1"><a	href="leaveSummary.do?sort=empFullName" title="Sort by employee full name">Employee Name</a></th>
						<th style="text-align: left" rowspan="1"><a	href="leaveSummary.do?sort=user" title="Sort by user">Username</a></th>
						<th style="text-align: left" rowspan="1"><a	href="leaveSummary.do?sort=firstLeave" title="Sort by first leave date">Leave From</a></th>
						<th style="text-align: left" rowspan="1"><a	href="leaveSummary.do?sort=lastLeave" title="Sort by last leave">Leave To</a></th>
						<th style="text-align: left" rowspan="1"><a	href="leaveSummary.do?sort=totalLeaved" title="Sort by total leaved">Duration</a></th>
						<th style="text-align: left" rowspan="1"><a	href="leaveSummary.do?sort=supervisorFullName" title="Sort by supervisor's fullname">Supervisor Name</a></th>
						<th style="text-align: left" rowspan="1"><a	href="leaveSummary.do?sort=supComment" title="Sort by supervisor's comment">Sup's Comment</a></th>
						<th style="text-align: left" rowspan="1"><a	href="leaveSummary.do?sort=leaveTypeName" title="Sort by leaveType">Leave Type</a></th>
						<th style="text-align: left" rowspan="1"><a	href="leaveSummary.do?sort=approved" title="Sort by sup's approval">Sup's Approval</a></th>
						<th style="text-align: left" rowspan="1"><a	href="leaveSummary.do?sort=timeApproved" title="Sort by time approval">Time Approval</a></th>
						<th style="text-align: left; color: white;" rowspan="1">Filter</th>
					</tr>
				</thead>
				<tbody>					
					<logic:iterate id="listObjs" name="leaveSummary" property="listObjs" scope="session" indexId="counter">
						<tr class='<%= counter.intValue()%2 == 0 ? "even" : "odd" %>' >
							<td class="left"></td>
							<td class="left"><a href="javascript:openPopup('leaveSummaryUpdate.do?act=edit&id=<bean:write name="listObjs" property="id"/>', 'Edit Leave Summary','645px','280px')"><bean:write name="listObjs" property="empFullName"/></a></td>
							<td class="left"><bean:write name="listObjs" property="user"/></td>
							<td class="left"><bean:write name="listObjs" property="firstLeaveStr"/></td>
							<td class="left"><bean:write name="listObjs" property="lastLeaveStr"/></td>
							<td class="left"><bean:write name="listObjs" property="totalLeavedThisTime"/>&nbsp;day(s)</td>
							<td class="left"><bean:write name="listObjs" property="supervisorFullName"/></td>
							<td class="left"><bean:write name="listObjs" property="supComment"/></td>
							<td class="left"><bean:write name="listObjs" property="leaveTypeName"/></td>
							<td class="left">
								<logic:notEmpty name="listObjs" property="approved">
									<logic:equal value="true" name="listObjs" property="approved">
										<center><img src="./images/accept.png"></img></center>
									</logic:equal>
									<logic:equal value="false" name="listObjs" property="approved">
										<center><img src="./images/delete.png"></img></center>
									</logic:equal>
								</logic:notEmpty>
							</td>
							<td class="left">
								<logic:equal value="true" name="listObjs" property="timeApproved">
									<center><img src="./images/accept.png"></img></center>
								</logic:equal>
								<logic:equal value="false" name="listObjs" property="timeApproved">
									<center><img src="./images/delete.png"></img></center>
								</logic:equal>
							</td>
							<td>
								<center>
									<a href="leaveSummary.do?filter=true&empNum=<bean:write name="listObjs" property="empNum"/>"><img src="./images/filter.png"></img></a>
								</center>
							</td>
						</tr>
					</logic:iterate>
				</tbody>
			</table>

			<div id="pageListId" style="margin-right: 10px;margin-bottom: 4px;margin-top: 4px;">
				<logic:iterate id="pageListId" name="leaveSummary" property="listPages" indexId="counter">
					<logic:equal name="pageListId" value="false" property="isCurrent">
						<td><a style="color: black; font-weight: bold; margin-left: 5px; font-size: 12px;" 
							href="leaveSummary.do?page=<bean:write name="pageListId" property="value"/>">
							<bean:write name="pageListId" property="label"/></a></td>
					</logic:equal>
					<logic:notEqual name="pageListId" value="false" property="isCurrent">
						<td><a style="color: red; font-weight: bold; margin-left: 5px; font-size: 13px;">
							<bean:write name="pageListId" property="label"/></a></td>
					</logic:notEqual>
				</logic:iterate>
			</div>  
	</div>
	</html:form>
</body>
</html>